package com.itcncp.wechat.app.rpc.service.impl;

import com.itcncp.common.annotation.BaseService;
import com.itcncp.common.base.BaseServiceImpl;
import com.itcncp.wechat.app.dao.mapper.ItcsTransJnlMapper;
import com.itcncp.wechat.app.dao.model.ItcsTransJnl;
import com.itcncp.wechat.app.dao.model.ItcsTransJnlExample;
import com.itcncp.wechat.app.rpc.api.ItcsTransJnlService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* ItcsTransJnlService实现
* Created by itcncp on 2018/1/12.
*/
@Service
@Transactional
@BaseService
public class ItcsTransJnlServiceImpl extends BaseServiceImpl<ItcsTransJnlMapper, ItcsTransJnl, ItcsTransJnlExample>
        implements ItcsTransJnlService {

    private static final Logger LOGGER = LoggerFactory.getLogger(ItcsTransJnlServiceImpl.class);

    @Autowired
    ItcsTransJnlMapper itcsTransJnlDao;

    /**
     * 统计该用户属于某一车牌下的通行费记录汇总
     * @param userId
     * @param plateno
     * @return
     */
    @Override
    public ItcsTransJnl totalPlateTollFare(Long userId, String plateno) {
        ItcsTransJnl itcsTransJnl = new ItcsTransJnl();
        itcsTransJnl.setUserId(userId);
        itcsTransJnl.setCarPlate(plateno);
        return itcsTransJnlDao.totalPlateTollFare(itcsTransJnl);
    }

    /**
     * 根据用户在在白名单中的车牌查询当前30内的订单信息
     * @param userId
     * @return
     */
    @Override
    public ItcsTransJnl getByWxitWhitelistUserId(Long userId) {
        return itcsTransJnlDao.getByWxitWhitelistUserId(userId);
    }

}